<?php
class SouthPizzaStore extends PizzaStore {
    protected function createPizza($type) {
        $eastFactory = new SouthPizzaStore();
        $pizza = null;
        switch ($type)
        {
            case 'egg' :
                $pizza = new EggPizza();
                break;
            case 'caomei' :
                $pizza = new CaomeiPizza();
                break;
        }
        if (!empty($pizza))
        {
            $pizza->setFactory($eastFactory);
        }
        return $pizza;
    }
}